package com.labofjet.service;

import com.labofjet.util.SpringContextUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.method.ControllerAdviceBean;

import java.util.Map;

@Service("testBean")
public class TestService2 implements BeanNameAware, InitializingBean {
	@Override
	public void setBeanName(String name) {
		//System.out.println(name);
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		ApplicationContext applicationContext = SpringContextUtils.getApplicationContext();
		for (String name : BeanFactoryUtils.beanNamesForTypeIncludingAncestors(applicationContext, Object.class)) {
			//System.out.println(name);
		}
	}
}
